﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Site.Master" AutoEventWireup="true" CodeBehind="ChangePassword.aspx.cs" Inherits="FortuneHeaven.Web.Pages.UserCenter.ChangePassword" %>
<%@ Register Src="~/Controls/UserInforHead.ascx" TagPrefix="uc" TagName="UserInforHead" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link type="text/css" rel="stylesheet" href="../../Content/CSS/person.css" />
 <script type="text/javascript">
     function GetLevel(s) {
         if (s.length < 4) {
             return 0;
         }
         var ls = 0;
         if (s.match(/[a-z]/ig)) {
             ls++;
         }
         if (s.match(/[0-9]/ig)) {
             ls++;
         }
         if (s.match(/(.[^a-z0-9])/ig)) {
             ls++;
         }
         if (s.length < 6 && ls > 0) {
             ls--;
         }
         return ls
     }
     function Evaluate(s) {
         var ls = GetLevel(s);
         Clear();
         if (ls <=1) {
             $("#first").css("background-color", "black");
        }
        if (ls == 2) {
            $("#second").css("background-color", "#FFCC33"); 
        }
        if (ls >= 3) {
            $("#third").css("background-color", "#008000"); 
        }
    }
    function Clear() {
        $(".pwdstrong").css("background-color", "#e0e0e0");
    }
    $(document).ready(function () {
        $("#<%=txtNewPassword.ClientID%>").keyup(function () {
            Evaluate($("#<%=txtNewPassword.ClientID%>").val());
           
        });
    });
    function CheckStatus() {
        var currentpwd = $("#<%=txtCurrentPassword.ClientID%>");
        var newpwd = $("#<%=txtNewPassword.ClientID%>");
        var repwd = $("#<%=txtReinput.ClientID%>")
        if (!currentpwd.val() || currentpwd.val() == "") {
            alert("当前密码不能为空");
            return false;
        }
        if (!newpwd.val() || newpwd.val() == "") {
            alert("新密码不能为空");
            return false;
        }
        if (!repwd.val() || repwd.val() == "") {
            alert("确认密码不能为空");
            return false;
        }
        return true;
    }
  </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="main">
      <div class="top"><span class="left">个人中心</span><span class="right">欢迎您，<asp:Literal id="ltName" runat="server"></asp:Literal></span></div>
      <div class="body">
         <uc:UserInforHead id="ucInforHead"  runat="server"></uc:UserInforHead>
         <h1>当前密码：<asp:TextBox TextMode="Password" ID="txtCurrentPassword" runat="server"></asp:TextBox></h1>
         <h1>新的密码：<asp:TextBox TextMode="Password"  ID="txtNewPassword"  runat="server"></asp:TextBox></h1>
         <h2 style="margin: 0px auto 5px;">安全强度</h2>
          <div style="margin: 0px auto 5px; width: 380px;">
          <table width="180" cellspacing="0" cellpadding="0" style="height: 4px; margin-left:2px;"  id="passwdBar">
         <tbody><tr>
  <td  height="4" id="first" class="pwdstrong" style="width: 60px; background-color:#e0e0e0" ></td>
  <td  height="4" id="second"class="pwdstrong"  style="width: 60px;background-color:#e0e0e0"></td>
  <td  height="4" id="third" class="pwdstrong"  style="width: 60px;background-color:#e0e0e0"></td>
  </tr></tbody></table>
  </div>
          <h1>确认密码：<asp:TextBox TextMode="Password" ID="txtReinput" runat="server"></asp:TextBox></h1>
         <h2><asp:LinkButton ID="btnSave" runat="server" CssClass="onelink" OnClick="SavePassword" OnClientClick="return CheckStatus();">提交</asp:LinkButton> <a class="twolink" href="<%= Page.ResolveUrl("~/Default.aspx")%>">返回</a></h2>
      </div>
    </div>
</asp:Content>
